package com.itcast.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itcast.entity.Result;
import com.itcast.pojo.Menu;
import com.itcast.service.MenuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/menu")
public class MenuController {
    @Reference
    private MenuService menuService;

    @RequestMapping("/findAllMenu")
    private Result findAllMenu() {
        try {
            List<Menu> menuList = menuService.findAllMenu();
            return Result.success("", menuList);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error("网络繁忙");
        }
    }

}
